package com.feige.auth.controller;


import com.feige.auth.pojo.IUser;
import com.feige.auth.pojo.LoginBody;
import com.feige.auth.pojo.PrincipleDto;
import com.feige.auth.pojo.PrinciplePo;
import com.feige.auth.service.PrincipleService;
import com.feige.base.controller.BaseController;
import com.feige.web.result.SingleResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author feige
 */
@RestController
@RequestMapping("/principle")
@Api(tags = "登录控制器")
public class PrincipleController extends BaseController<PrincipleService, PrinciplePo, PrincipleDto> {


    @PostMapping("/login")
    @ApiOperation(value = "登录")
    public SingleResult<IUser> login(@RequestBody @Validated LoginBody loginBody){
        return SingleResult.success(baseService.login(loginBody));
    }

}
